home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / dev / lang / python020.lha / python / lib / types.py < prev    next >
Text File  |  1995-10-22  |  1KB  |  47 lines

  1. # Define names for all type symbols known in the standard interpreter.
  2. # Types that are part of optional modules (e.g. array) are not listed.
  3.  
  4. import sys
  5.  
  6. NoneType = type(None)
  7. TypeType = type(NoneType)
  8.  
  9. IntType = type(0)
  10. LongType = type(0L)
  11. FloatType = type(0.0)
  12.  
  13. StringType = type('')
  14.  
  15. TupleType = type(())
  16. ListType = type([])
  17. DictType = DictionaryType = type({})
  18.  
  19. def _f(): pass
  20. FunctionType = type(_f)
  21. LambdaType = type(lambda: None)        # Same as FunctionType
  22. CodeType = type(_f.func_code)
  23.  
  24. class _C:
  25.     def _m(self): pass
  26. ClassType = type(_C)
  27. UnboundMethodType = type(_C._m)        # Same as MethodType
  28. _x = _C()
  29. InstanceType = type(_x)
  30. MethodType = type(_x._m)
  31.  
  32. BuiltinFunctionType = type(len)
  33. BuiltinMethodType = type([].append)    # Same as BuiltinFunctionType
  34.  
  35. ModuleType = type(sys)
  36.  
  37. FileType = type(sys.stdin)        # XXX what if it was assigned to?
  38. XRangeType = type(xrange(0))
  39.  
  40. try:
  41.     raise TypeError
  42. except TypeError:
  43.     TracebackType = type(sys.exc_traceback)
  44.     FrameType = type(sys.exc_traceback.tb_frame)
  45.  
  46. del sys, _f, _C, _x            # Not for export
  47.